// 公用接口api
import { fetch, oss } from '@/utils/fetch.js';
// get请求示例
export function getdata(params) {
  return fetch({
    url: '/questionliburl',
    method: 'GET',
    data: params,
  });
}
// 获取优惠券详情
export function getCouponDetail(params) {
  return fetch({
    url: '/usercenter/operation/activity/course/getCouponDetail',
    method: 'POST',
    data: params,
  });
}

// 添加活动
export function addActivity(params) {
  return fetch({
    url: '/usercenter/operation/activity/addActivity',
    method: 'POST',
    data: params,
  });
}
// 获取活动详情
export function getActivityDetails(params) {
  return fetch({
    url: '/usercenter/operation/activity/getActivityDetails',
    method: 'POST',
    data: params,
  });
}

// 获取优惠券列表
export function getCouponList(params) {
  return fetch({
    url: '/usercenter/operation/activity/course/getCouponList',
    method: 'POST',
    data: params,
  });
}
// 优惠券枚举

export function getActivityCouponResource(params) {
  return fetch({
    url: '/usercenter/operation/inputSource/getActivityCouponResource',
    method: 'POST',
    data: params,
  });
}

// 添加优惠券
export function addCoupon(params) {
  return fetch({
    url: '/usercenter/operation/activity/course/addCoupon',
    method: 'POST',
    data: params,
  });
}

// 更新优惠券状态
export function updateCouponStatus(params) {
  return fetch({
    url: '/usercenter/operation/activity/course/updateCouponStatus',
    method: 'POST',
    data: params,
  });
}

// oss封装上传文件
export function ossUpload(params, type) {
  return oss({
    baseUrl: '/usercenter/resource/file/upload',
    method: 'POST',
    data: params,
    type: type,
  });
}
// 获取活动枚举资源
export function getActivityResource(params) {
  return fetch({
    url: '/usercenter/operation/inputSource/getActivityResource',
    method: 'POST',
    data: params,
  });
}

// 获取活动管理列表
export function getActivityList(params) {
  return fetch({
    url: '/usercenter/operation/activity/getActivityList',
    method: 'POST',
    data: params,
  });
}

// 开启活动
export function openActivity(params) {
  return fetch({
    url: '/usercenter/operation/activity/openActivity',
    method: 'POST',
    data: params,
  });
}

// 关闭活动
export function closeActivity(params) {
  return fetch({
    url: '/usercenter/operation/activity/closeActivity',
    method: 'POST',
    data: params,
  });
}
